package edu.zut.cs.software.perfect.manage.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import edu.zut.cs.software.perfect.base.domain.BaseTreeEntity;
import edu.zut.cs.software.perfect.student.domain.Student;

/**
 * @ClassName admin
 * @Description TODO
 * @Author wst
 * @Date 2020年3月20日 下午1:18:14
 * @Version 1.0
 */
@Table(name = "T_ADMINISTRATOR")
@Entity
@NamedQueries({ @NamedQuery(name = "Administrator.getRoot", query = "select m from Administrator m where m.parent is null") })
public class Administrator extends BaseTreeEntity<Administrator,Long> {

	private static final long serialVersionUID = -3812505934603297808L;

	/**
	 * get name
	 * @return
	 */
	public String getName() {
		return name;
	}
	/**
	 * set name
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * get serial_number
	 * @return
	 */
	public String getSerial_number() {
		return serial_number;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	/**
	 * set serial_number
	 * @param serial_number
	 */
	public void setSerial_number(String serial_number) {
		this.serial_number = serial_number;
	}
	/**
	 * name
	 */
	@Column(name = "NAME")
	String name;
	
	@Column(name = "ID")
	long id;
	/**
	 * serial_number
	 */
	@Column(name = "SNB")
	String serial_number;
	
	@OneToMany(mappedBy="Administrator",cascade=CascadeType.REMOVE,fetch=FetchType.EAGER)
	List<InternalDate> internalDate;
	
	@OneToMany(mappedBy="Administrator",cascade=CascadeType.REMOVE,fetch=FetchType.EAGER)
	List<UserGroup> userGroup;
	
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	/**
	 * 
	 */
	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}
	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
	}

}
